<template>
  <div>
    <div v-for="item in resourceTree" :key="item.id">
      <el-col :span="6" :offset="2">
        <el-checkbox
          :label="item.code"
          :checked="item.isSelected"
          v-model="item.isSelected"
          @change="changeCheck(item.code)"
          >{{ item.title }}</el-checkbox
        >
      </el-col>
      <tree-menus :resourceTree="item.children"></tree-menus>
    </div>
  </div>
</template>

<script>
export default {
  name: 'treeMenus',
  props: {
    resourceTree: Array,
    dataPermission: Array,
  },
  data() {
    return {
      dataPer: '',
    }
  },
  methods: {
    changeCheck(val) {
       for(var i=0, le=this.resourceTree.length;i<le; i++){
         if(this.resourceTree[i].code == val){
           this.resourceTree[i].isSelected= true
         }
       }
       console.log("this.resourceTree",this.resourceTree)
    },
  },
}
</script>

<style lang="scss" scoped></style>
